package deo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-04-14
 * Time: 16:09
 */
class SingletonLazy1{
    private static volatile SingletonLazy1 instance = null;

    private static Object locker = new Object();

    public static SingletonLazy1 getInstance(){
        if(instance == null){
            synchronized(locker){
                if(instance == null){
                    instance = new SingletonLazy1();
                }

            }
        }
        return instance;
    }

    private SingletonLazy1(){

    }
}

public class demo4 {
    public static void main(String[] args) {
        SingletonLazy1 t1 = SingletonLazy1.getInstance();
        SingletonLazy1 t2 = SingletonLazy1.getInstance();
        System.out.println(t1 == t2);
    }
}
